package com.tanavlog.web.controller;


import com.tanavlog.web.dto.request.RegistryUserInfoCheckDTO;
import com.tanavlog.web.validation.RegistryInfoCheckGroupOne;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/test")
public class TestController {


    /**
     * 无参压测
     * @return
     */
    @GetMapping("/load-test")
    public String loadTest() {
        return "yes";
    }

    /**
     * 有参数测试
     * @param registryUserInfoCheckDTO
     * @return
     */
    @PostMapping("/load-test-json")
    public String loadTestJson(@RequestBody @Validated(RegistryInfoCheckGroupOne.class) RegistryUserInfoCheckDTO registryUserInfoCheckDTO) {
        System.out.println("username: " + registryUserInfoCheckDTO.getUsername() + ", email: " + registryUserInfoCheckDTO.getEmail());
        return "测试成功";
    }

    @GetMapping("/test")
    public String test() {
        return "good";
    }




}
